package com.desmart.renjiao.memberinfo;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.desmart.renjiao.R;
import com.desmart.renjiao.bean.MemberInfo;
import com.desmart.renjiao.contants.Constants;
import com.lemon.library.common.ARoutePath;
import com.lemon.library.common.CommonActivity;


@Route(path = ARoutePath.addresslist.MemberInfoActivity)
public class MemberInfoActivity extends CommonActivity{

    private MemberInfo item;
    private TextView tvUserName;
    private TextView tvNo;
    private TextView mobileValue;
    private TextView telValue;
    private TextView emailValue;
    private TextView tvDepartmentName;
    private TextView tvCompanyName;

    @Override
    public int bindLayout() {
        return R.layout.activity_member_info;
    }

    @Override
    public void initView(Activity activity) {
        setTitleText("个人信息");
        tvUserName = activity.findViewById(R.id.tv_username);
        tvNo = activity.findViewById(R.id.tv_no);

        //手机
        View moblieLayout = activity.findViewById(R.id.layout_mobile);
        TextView mobileTv = moblieLayout.findViewById(R.id.tv_title);
        mobileValue = moblieLayout.findViewById(R.id.tv_value);
        mobileTv.setText("手机");

        //座机
        View telLayout = activity.findViewById(R.id.layout_tel);
        TextView telTv = telLayout.findViewById(R.id.tv_title);
        telValue = telLayout.findViewById(R.id.tv_value);
        telTv.setText("座机");

        //邮箱
        View emailLayout = activity.findViewById(R.id.layout_email);
        TextView emailTv = emailLayout.findViewById(R.id.tv_title);
        emailValue = emailLayout.findViewById(R.id.tv_value);
        emailTv.setText("邮箱");

        //部门
        tvDepartmentName = activity.findViewById(R.id.tv_department_name);
        tvCompanyName = activity.findViewById(R.id.tv_company_name);
    }

    @Override
    public void initData(Context context) {
        item = (MemberInfo) getIntent().getSerializableExtra(Constants.Memember.Key_MemberInfo);
        if (item == null)
            return;
        tvUserName.setText(item.getUsername());
        tvNo.setText(item.getSapsystemid());
        mobileValue.setText(item.getMobile());
        telValue.setText(item.getFixedtelephone());
        emailValue.setText(item.getEmail());
        tvDepartmentName.setText(item.getDepartmentname());
        tvCompanyName.setText(item.getCompanyname());
    }
}
